package io.renren.modules.weldingmachinehisdata.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.renren.modules.welderunnormal.entity.WelderunnormalEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.weldingmachinehisdata.entity.WeldingmachineHisdataEntity;
import io.renren.modules.weldingmachinehisdata.service.WeldingmachineHisdataService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
@RestController
@RequestMapping("weldingmachinehisdata/weldingmachinehisdata")
public class WeldingmachineHisdataController {
    @Autowired
    private WeldingmachineHisdataService weldingmachineHisdataService;


    @GetMapping("getwmhisdata")
    public List<WelderunnormalEntity> getwmhisdata(@RequestParam(value = "cncName",required = false) String cncName, @RequestParam(value = "createDate",required = false) String createDate){
        return weldingmachineHisdataService.getwmhisdata(cncName,createDate);
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("weldingmachinehisdata:weldingmachinehisdata:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = weldingmachineHisdataService.queryPage(params);

        return R.ok().put("page", page);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{no}")
    @RequiresPermissions("weldingmachinehisdata:weldingmachinehisdata:info")
    public R info(@PathVariable("no") Integer no){
		WeldingmachineHisdataEntity weldingmachineHisdata = weldingmachineHisdataService.getById(no);

        return R.ok().put("weldingmachineHisdata", weldingmachineHisdata);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("weldingmachinehisdata:weldingmachinehisdata:save")
    public R save(@RequestBody WeldingmachineHisdataEntity weldingmachineHisdata){
		weldingmachineHisdataService.save(weldingmachineHisdata);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("weldingmachinehisdata:weldingmachinehisdata:update")
    public R update(@RequestBody WeldingmachineHisdataEntity weldingmachineHisdata){
		weldingmachineHisdataService.updateById(weldingmachineHisdata);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("weldingmachinehisdata:weldingmachinehisdata:delete")
    public R delete(@RequestBody Integer[] nos){
		weldingmachineHisdataService.removeByIds(Arrays.asList(nos));

        return R.ok();
    }

}
